Next | Prev | Up | Top | Contents | Index

Entry Point edtinit()

The pfxedtinit() entry is designed to initialize devices that are configured using the VECTOR statement in the system configuration file (see "System Configuration Files"). The entry point name is a contraction of "early device table initialization."

The VECTOR statement specifies hardware details about a device on the VME, GIO, or EISA bus, including iospace addresses, interrupt level, and an integer parameter. The VECTOR statement can specify a "probe" parameter that lets the kernel test for the existence of the specified hardware.

When the kernel processes a VECTOR statement during bootstrap and the probe is successful (or no probe is specified), the kernel stores the VECTOR parameters in a structure of type edt_t. (This structure is declared in sys/edt.h.)

Each time the kernel loads a driver that is named in a VECTOR statement, the kernel calls the driver's pfxedtinit() entry one time for each VECTOR statement that named that driver and had a successful probe (or that had no probe). VECTOR statements are processed in reverse sequence to the order in which they are coded in /var/sysgen/system files.

The prototype of the pfxedtinit() entry is

void pfxedtinit(edt_t *e);

The edt_t contains at least the following fields (see the system(4) reference page for the corresponding VECTOR parameters):

e_bus_typeInteger specifying the bus type; constant values are declared in sys/edt.h, for example ADAP_VME, ADAP_GIO, or ADAP_EISA.
e_adapInteger specifying the adapter (bus) number.
e_ctlrValue from the VECTOR ctlr= parameter; typically the device minor number.
e_spaceArray of up to three I/O space structures of type iospace_t.

The difference between pfxinit() and pfxedtinit() is that pfxedtinit() is parameterized with information from the VECTOR line, and is called once for each VECTOR line that is associated with real hardware.

A driver that uses pfxedtinit() needs to save the edt_t information in a data structure. If the driver supports multiple devices--that is, if it can be called for multiple VECTOR statements--it needs to allocate an array or chain of structures, and save new data on each entry.


Next | Prev | Up | Top | Contents | Index